package com.company.control;

import com.company.bean.UserInfoBean;
import com.company.service.LoginService;
import org.omg.CORBA.UserException;

import java.util.List;

public class LoginControl {
    //使用spring xml的配置方式，进行类与类依赖注入
    LoginService loginService;//成员变量属性与spring的配置的属性名一致
    UserInfoBean userInfoBean;

    //集合的依赖注入
    //依赖一个集合对象，也可以进行依赖注入
    List<Object> listStrs;

    public  boolean doLogin(){
        boolean canLogined = false;
        //1.获取参数实体类bean
       // UserInfoBean userInfoBean= new UserInfoBean();

        //2.设置参数省略
        //userInfoBean.setUserName("小李");//进行类与类之间进行依赖关系时进行省略

        //3.调用service层
        //  LoginService loginService = new LoginService();

        //依赖list集合注入
        System.out.println("依赖注入list集合的内容："+listStrs.toString());
        canLogined = loginService.doLogin(userInfoBean);

        return canLogined;
    }

    public void setLoginService(LoginService loginService) {
        this.loginService = loginService;
    }

    public void setUserInfoBean(UserInfoBean userInfoBean) {
        this.userInfoBean = userInfoBean;
    }

    public LoginService getLoginService() {
        return loginService;
    }

    public UserInfoBean getUserInfoBean() {
        return userInfoBean;
    }

    public List<Object> getListStrs() {
        return listStrs;
    }

    public void setListStrs(List<Object> listStrs) {
        this.listStrs = listStrs;
    }
}
